from django.conf import settings

from recruit.models import Recruit,Enterprise
from rest_framework.serializers import ModelSerializer
from rest_framework import serializers

class EnterpriseSimpleSerializer(ModelSerializer):
    """企业模型类序列化器 部分字段"""

    recruits = serializers.PrimaryKeyRelatedField(read_only=True,many=True)
    class Meta:
        model = Enterprise
        fields = ['id','name','labels','logo','summary','recruits']


class RecruitSimpleSerializer(ModelSerializer):
    """推荐职位模块 模型类序列化器"""

    enterprise = EnterpriseSimpleSerializer()
    class Meta:
        model = Recruit
        # exclude = ['address','state','detailcontent','detailrequire','visits','users']
        fields = ['id','jobname','salary','condition','education','type','city','createtime',
                  'enterprise','labels','visits',
                  ]

